import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/components/Login.vue'
import Register from '@/components/Register.vue'
import HomePage from '@/components/HomePage.vue'
import GoodsDetail from '@/components/GoodsDetail.vue'
import Grzx from '@/components/Grzx.vue'
import Gwc from '@/components/Gwc.vue'
import MyAddress from '@/components/grzx/MyAddress.vue'
import MyAppraise from '@/components/grzx/MyAppraise.vue'
import MyCenter from '@/components/grzx/MyCenter.vue'
import MyInformation from '@/components/grzx/MyInformation.vue'
import MyOrder from '@/components/grzx/MyOrder.vue'
import MyPassword from '@/components/grzx/MyPassword.vue'

Vue.use(VueRouter)

const routes = [
  { path: '/', redirect: '/homePage' },
  { path: '/login', component: Login },
  { path: '/register', component: Register },
  { path: '/homePage', component: HomePage },
  { path: '/goodDetail/:id', component: GoodsDetail, props: true },
  {
    path: '/grzx',
    component: Grzx,
    redirect: '/grzx/center',
    children: [
      { path: 'address', component: MyAddress },
      { path: 'appraise', component: MyAppraise },
      { path: 'center', component: MyCenter },
      { path: 'info', component: MyInformation },
      { path: 'order', component: MyOrder },
      { path: 'password', component: MyPassword }
    ]
  },
  { path: '/gwc', component: Gwc }
]

const router = new VueRouter({
  routes
})

export default router
